home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK2.toast / Development Kits (Disc 2) / ScriptX / Draggable ScriptX Folders / utils / c-api / bitarray.sx < prev    next >
Encoding:
Text File  |  1995-11-22  |  665 b   |  33 lines  |  [TEXT/ttxt]

  1. --<<<
  2.  
  3. class BitArray (MemoryObject)
  4. inst vars
  5.     bitSize
  6. class methods
  7.     method afterInit self #rest args -> (
  8.         apply nextMethod self args
  9.         process (new loader) "c-api"
  10.         )
  11. end
  12.  
  13.  
  14. method init self {class BitArray} #rest args #key numBits:(16) -> (
  15.     if (mod numBits 8 !== 0) do
  16.         report generalError #("numBits must be a multiple of 8\n")
  17.  
  18.     apply nextMethod self initialSize:((numBits / 8) as Integer) args
  19.     self.bitSize := numBits
  20.     clear self
  21.     )
  22.  
  23. method localEqual self {class BitArray} other -> (
  24.     bitequal self other
  25.     )
  26.  
  27. method prin self {class BitArray} how strm -> (
  28.     for i := 0 to (self.bitSize - 1) do
  29.       writeString strm ((getbit self i) as String)
  30.     )
  31.  
  32. -->>>
  33.